package com.iflyings.android.util

import android.Manifest
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.GrantPermissionRule
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith


@RunWith(AndroidJUnit4::class)
@LargeTest
class EthernetTest {
    @get:Rule
    var permissionRule: GrantPermissionRule =
        GrantPermissionRule.grant(Manifest.permission.ACCESS_NETWORK_STATE)

    @Test
    @Throws(InterruptedException::class)
    fun checkEthernet() {
        val appContext = InstrumentationRegistry.getInstrumentation().targetContext
        val manager = EthernetManager(appContext)
        manager.setDhcpIp()
        Thread.sleep(3000)
        assert(manager.isDhcpIp())
        manager.setStaticIp("192.168.1.32", "255.255.255.0", "192.168.1.1", "8.8.8.8", "8.8.4.4")
        Thread.sleep(3000)
        assert(!manager.isDhcpIp())
    }
}


